<?php
class Theater_model extends CI_Model {
	function getAll() {
		$query = $this->db->get ( 'theater' );
		return $query->result ( 'Theater' );
	}
	function get($id) {
		$query = $this->db->get_where ( 'theater', array (
				'id' => $id 
		) );
		
		return $query->row ( 0, 'Theater' );
	}
	function delete($id) {
		return $this->db->delete ( 'theater', array (
				'id' => $id 
		) );
	}
	function insert($name, $address, $id) {
		return $this->db->insert ( 'theater', array (
				'name' => $name,
				'address' => $address,
				'id' => $id 
		) );
	}
	function update($theater) {
		$this->db->where ( 'id', $theater->id );
		return $this->db->update ( 'theater', array (
				'name' => $theater->name,
				'address' => $theater->address,
				'id' => $theater->id 
		) );
	}
	
	function show_theaters() {
		return $this->db->query("select name, address from theater");
	}
}
?>